package com.aidong.myprofile.biz.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.aidong.login.dao.MemberInformationDao;
import com.aidong.myprofile.biz.MyAidongTimeBiz;
import com.aidong.myprofile.dao.MyAidongTimeDao;

@Service("aidongTimeBiz")
public class MyAidongTimeBizImpl implements MyAidongTimeBiz {
	
	private MyAidongTimeDao aidongTimeDao;
	
	private MemberInformationDao memberInformationDao;

	@Autowired
	public void setMemberInformationDao(MemberInformationDao memberInformationDao) {
		this.memberInformationDao = memberInformationDao;
	}

	@Autowired
	public void setAidongTimeDao(MyAidongTimeDao aidongTimeDao) {
		this.aidongTimeDao = aidongTimeDao;
	}

	/**
	 * 我的爱动时刻列表
	 * @param idongId
	 */
	@Override
	public List<Map<String, Object>> getMyAidongTime(Map<String, Object> map) {
//		memberInformationDao.addMemberPopty(Integer.parseInt(map.get("idongId").toString()));
		return aidongTimeDao.getMyAidongTime(map);
	}

	/**
	 * 查看好友最近的爱动时刻照片
	 * @param idongId
	 * @return
	 */
	@Override
	public List<Map<String, Object>> getHailAidongTime(int idongId) {
		return aidongTimeDao.getHailAidongTime(idongId);
	}

	/**
	 * 爱动时刻详情
	 * @param dynamicId
	 * @return
	 */
	@Override
	public Map<String, Object> getMyAidongTimeDetail(int dynamicId) {
		return aidongTimeDao.getMyAidongTimeDetail(dynamicId);
	}

	/**
	 * 单条点赞列表
	 * @param dynamicId
	 * @return
	 */
	@Override
	public List<Map<String, Object>> getTrnPraiseByOne(int dynamicId) {
		return aidongTimeDao.getTrnPraiseByOne(dynamicId);
	}

	/**
	 * 单条评论列表
	 * @param dynamicId
	 * @return
	 */
	@Override
	public List<Map<String, Object>> getTrnDynamicCommentByOne(int dynamicId) {
		return aidongTimeDao.getTrnDynamicCommentByOne(dynamicId);
	}

	/**
	 * 删除我的爱动时刻
	 * @param map
	 */
	@Override
	public void delAidongTime(Map<String, Object> map) {
		//减少热度
		Map<String, Object> paraMap = new HashMap<String, Object>();
		paraMap.put("idongId", map.get("idongId").toString());
		memberInformationDao.delMemberPopty(paraMap);
		
		aidongTimeDao.delAidongTime(map);
	}

}
